Group

Object Hierarchy | 関連する C++クラス:Group

継承

SIObject

ProjectItem

SceneItem

グループ

導入

v1.0

詳細

Group は関連するオブジェクトのコレクションです。

メソッド

AddCustomOp AddCustomProperty AddMaterial AddMember
AddProperty AddScriptedOp AddScriptedOpFromFile AnimatedParameters2
ApplyEnvelope BelongsToオペレータ EvaluateAt GetICEAttributeFromName
GetLocalPropertyFromName GetPropertyFromName IsA IsAnimated2
IsClassOfオペレータ IsEqualToオペレータ IsKindOf IsLockedオペレータ
IsMember IsSelectedオペレータ LockOwners RemoveAllMembers
RemoveMember SetAsSelectedオペレータ SetCapabilityFlagオペレータ SetLock
SetMaterial TaggedParameters UnSetLock  
       

プロパティ

Application BranchFlagオペレータ Capabilitiesオペレータ Categories
Envelopes EvaluationID ExpandedMembers Familiesオペレータ
FullNameオペレータ Help HierarchicalEvaluationID ICEAttributes
LocalProperties LockLevelオペレータ LockMastersオペレータ LockTypeオペレータ
Material Members Model Nameオペレータ
NestedObjects ObjectID Origin OriginPath
Owners PPGLayoutオペレータ Parametersオペレータ Parent
Parent3DObject Properties Selectedオペレータ Typeオペレータ

1. VBScript の例

set oRoot = Application.ActiveProject.ActiveScene.Root
set oGroup = oRoot.AddGroup
set oCube = oRoot.AddGeometry( "Cube", "MeshSurface" )
oGroup.AddMember oCube
for each oMember in oGroup.Members
        LogMessage oMember.Name & " is a member of the " & oGroup.Name
next

2. JScript の例

/* ----------------------------------------------------------
        This example shows how to find groups under the
        scene root or under a specific model given the 
        following structure:
Scene_Root                        Model    Group
+ RootGroup                              *
+ ChildModel                    *
+ ChildGroup                         *
+ AnotherChildModel             *
+ AnotherChildGroup                  *
+ GrandChildModel           *
+ GrandChildGroup                *
=====    =====
3        4
        Note: The Model.Groups property gets only 
                the immediate children of a model 
                (unlike the X3DObject.Models property, which gets all
                nested models.
*/
// ----------------------------------------------------------
//
//      SETUP
//
NewScene( null, false );
// Set up a scene with 4 objects
var oRoot = ActiveSceneRoot;
var oMbr1 = oRoot.AddGeometry( "Disc", "MeshSurface" );
var oMbr2 = oRoot.AddGeometry( "Torus", "MeshSurface" );
var oMbr3 = oRoot.AddGeometry( "Sphere", "MeshSurface" );
var oMbr4 = oRoot.AddNull();
// Create a group under the root 
oRoot.AddGroup( oMbr1, "RootGroup" );
// Create a new model and another group under the new model 
var oMdl = oRoot.AddModel( oMbr2, "ChildModel" );
oMdl.AddGroup( oMbr2, "ChildGroup" );
// Add another model to the root 
var oMdl = oRoot.AddModel( oMbr3, "AnotherChildModel" );
oMdl.AddGroup( oMbr3, "AnotherChildGroup" );
// Nest yet another model under the second child model
var oMdl = oMdl.AddModel( oMbr4, "GrandChildModel" );
oMdl.AddGroup( oMbr4, "GrandChildGroup" );
//----------------------------------------------------------
//
//      SEARCH
//
// Find all groups under the scene root
LogMessage( "******** GROUPS UNDER " + oRoot.Name + " ********" );
FindGroupsUnderModel( oRoot );
// Find all groups under 'AnotherChildModel' 
LogMessage( "******** GROUPS UNDER " + oMdl.Name + " ********" );
FindGroupsUnderModel( oMdl );
// Now find all groups in the scene
RecursiveGroupSearch( oRoot );
//----------------------------------------------------------
//
//      RESULTS
//
//INFO : "******** GROUPS UNDER Scene_Root ********"
//INFO : "RootGroup contains these members:"
//INFO : "      disc"
//INFO : "******** GROUPS UNDER GrandChildModel ********"
//INFO : "GrandChildModel.GrandChildGroup contains these members:"
//INFO : "      null"
//INFO : "******** FINDING ALL GROUPS IN THE SCENE ********"
//INFO : "# of models under the root: 3"
//INFO : "RootGroup contains these members:"
//INFO : "      disc"
//INFO : "ChildModel.ChildGroup contains these members:"
//INFO : "      torus"
//INFO : "AnotherChildModel.AnotherChildGroup contains these members:"
//INFO : "      sphere"
//INFO : "GrandChildModel.GrandChildGroup contains these members:"
//INFO : "      null"
//----------------------------------------------------------
//
//      HELPERS
//
// Finds all groups under a specific model (not recursive)
function FindGroupsUnderModel( in_model )
{
        // Find all groups under the specified model
        var oGrps = in_model.Groups;
        for (var g=0; g<oGrps.Count; g++) 
        {
                LogMessage( oGrps(g).FullName + " contains these members:" );
                var m = new Enumerator( oGrps(g).Members );
                for ( ; !m.atEnd(); m.moveNext() )
                {
                        LogMessage( "\t" + m.item().Name );
                }
        }
}
//----------------------------------------------------------
// Recursively finds all groups under a model. Because
// we can get every model recursively (except for our starting point, the 
// current model), we start by listing the groups under the 
// current model and then the groups for each model under
// it, calling FindGroupsUnderModel for each one.
function RecursiveGroupSearch( in_model )
{
        LogMessage( "******** FINDING ALL GROUPS IN THE SCENE ********" );
        LogMessage( "# of models under the root: " + in_model.Models.Count );
        // First print out the groups info for the current model
        FindGroupsUnderModel( in_model );
        // Then iterate over every model contained inside the
        // current model, printing the groups info for each one
        var mdl = new Enumerator( in_model.Models );
        for ( ; !mdl.atEnd(); mdl.moveNext() ) 
        {
                FindGroupsUnderModel( mdl.item() );
        }
}